// components/redPackageX/redPackageX.js
var colorParse = require("../../common/color.js");

Component({
    /**
   * 组件的属性列表
   */
    options: {
        addGlobalClass: true
    },
    properties: {
        redFlag: {
            type: Boolean,
            observer(newVal, oldVal, changePath) {
                this.setData({
                    flag: newVal
                });
            }
        },
        voucher: {
            type: Object,
            observer(newVal, oldVal, changePath) {
                this.setData({
                    voucherX: newVal
                });
            }
        },
        inx: {
            type: Number,
            observer(newVal, oldVal, changePath) {
                this.setData({
                    iii: newVal
                });
            }
        }
    },
    /**
   * 组件的初始数据
   */
    data: {
        flag: false,
        //false则不显示receive = 0的值，true显示receive=0的值，设为已领取
        id_index: ""
    },
    /**
   * 组件的方法列表
   */
    methods: {
        receiveDiscount(e) {
            var myDetail = {
                id: e.currentTarget.dataset.id,
                index: e.currentTarget.dataset.index
            };
            this.setData({
                id_index: e.currentTarget.dataset.index
            });
            this.triggerEvent("getRedPackage", myDetail, {});
        },
        goToRedMarket() {
            this.triggerEvent("goToRedMarket");
        }
    }
});